﻿using System.Collections.Generic;

namespace Practise02
{
    internal class Program
    {

        const string FILENAME = "D:\\Practise.txt";
        /// <summary>
        /// open certain file and compute the avg of all the numbers
        /// </summary>
        /// <param name="args"></param>
        static void Main(string[] args)
        {
            using (StreamReader reader = new StreamReader(FILENAME))
            {
                List<int> list = new List<int>();
                string line;
                while ((line = reader.ReadLine()) != null)
                {
                    int number;
                    
                   //Console.WriteLine(line); // 在控制台输出每一行 
                    if (int.TryParse(line, out number))
                    {
                        list.Add(number);
                    }
                    
                }
                double avg = list.Average();
                Console.WriteLine(avg);




            }
        }
    }
}
